<?php

function success_json($result = '', $code = \App\Enums\JsonReturnCode::成功)
{
    $success = true;
    $rs = compact('result', 'code', 'success');

    return response()->json($rs);
}

function error_json($message = '操作失败', $code = \App\Enums\JsonReturnCode::系统错误)
{
    $success = false;
    $rs = compact('message', 'code','success');

    return response()->json($rs);
}


function paginate($model)
{
    return success_json($model->apiPaginate());
}
